set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR RISV32)

set(TOOLCHAIN_DIR "/usr/bin")
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/riscv64-unknown-elf-gcc)
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_DIR}/riscv64-unknown-elf-gcc)
set(CMAKE_OBJCOPY ${TOOLCHAIN_DIR}/riscv64-unknown-elf-objcopy)
set(CMAKE_OBJDUMP ${TOOLCHAIN_DIR}/riscv64-unknown-elf-objdump)

set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_FLAGS "-nostdlib -fno-builtin -march=rv32ima -mabi=ilp32 -g -Wall")
set(USER_LD_FLAGS "-Ttext=0x80000000") 
set(ASM_OPTIONS "")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} ${ASM_OPTIONS}")
